const {Total}=require('../models');

module.exports=totals=>{
    let tasks=[];
    for(let total of totals){
        tasks.push(Total.findOneAndUpdate({'cat.id':total.cat.id},{
            cat:total.cat,
            total:total.totalPaging
        },{upsert:true}));
    }
    return Promise.all(tasks);
};